local mytable = setmetatable({key1 = "value1"}, {
  __index = function(mytable, key)
    if key == "key2" then
      return "metatablevalue"
    else
      return nil
    end
  end
})

-- print(mytable.key1,mytable.key2)



local table1 = {key1 = "value1", key2 = "value2"}
local table2 = {key3 = "value3", key4 = "value4"}

-- setmetatable(table1,table2)
-- print(table1.key3)

--setmetatable(table1, {__index = table2})
-- value1
-- value3
-- value5  nil

setmetatable(table1, {__newindex = table2})
-- value1
-- nil
-- nil     value5

print(table1.key1)
print(table1.key3)
table1.key5 = "value5"
print(table1.key5,table2.key5)








